﻿@model Tuple<IEnumerable<HCM_maps_website.Process.Place>,int>

@{
    ViewBag.Title = "Place";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<div id="content_page" class="place_page">
    <div id="data_content">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <th>ID</th>
                <th>Type</th>
                <th>FullName</th>
                <th>Address</th>
                <th>xLocation</th>
                <th>yLocation</th>
                <th>Info</th>
                <th>Picture</th>
                <th>Phone</th>
                <th>Website</th>
            </tr>
            @foreach(var place in Model.Item1){ 
                <tr>
                    <td name="id">@place.ID</td>
                    <td name="type">@place.Type</td>
                    <td name="fullname">@place.FullName</td>
                    <td name="addr">@place.Address</td>
                    <td name="xlocation">@place.xLocation</td>
                    <td name="ylocation">@place.yLocation</td>
                    <td name="info">@place.Info</td>
                    <td name="picture">@place.Picture</td>
                    <td name="phone">@place.Phone</td>
                    <td name="website">@place.Website</td>
                </tr>
            }
        </table>
    </div>

    <div id="pagination">
        <form id="submitpage" action="@Url.Action("Place")">
            <select name="ipage" onchange="SubmitForm('submitpage')">
                @if(@Model.Item2>HCM_maps_website.Controllers.AdminController.NUM_RECORD_PER_PAGE){
                    var page = (((@Model.Item2 % HCM_maps_website.Controllers.AdminController.NUM_RECORD_PER_PAGE != 0) ? 1 : 0) + @Model.Item2 / HCM_maps_website.Controllers.AdminController.NUM_RECORD_PER_PAGE);
                    for (int i = 0; i < page; i++)
                     {
                        if(Session["page"]!=null && (int)Session["page"] == i+1){
                        <option selected value="@(i+1)">page @(i+1)</option>
                        }else{
                            <option value="@(i+1)">page @(i+1)</option>
                        }
                    
                     }
                }
            </select>
        </form>
    </div>
    <div class="clear"></div>

    <form id="EditForm" class="Processdata" action="@Url.Action("EditPlace")">
        <span class="row"><label>Place Info:</label></span>
        <span class="row"><label>ID:</label><label name="id"></label><input type="hidden" name="id" />
        <span class="elright"><label>Type:</label><input type="text" name="type"/></span></span>
        <span class="row"><label>Fullname:</label><input class="elmax" name="fullname" type="text"/></span>
        <span class="row"><label>Address:</label><input class="elmax" name="addr" type="text"/></span>
        <span class="row"><label>Info:</label><input class="elmax" name="info" type="text"/></span>
        <span class="row"><label>Picture:</label><input class="elmax" name="picture" type="text"/></span>
        <span class="row"><label>Phone:</label><input type="text"  name="phone"/>
        <span class="elright"><label>Website:</label><input type="text"  name="website"/></span></span>
        <span class="row"><label>xLocation:</label><input name="xlocation" type="text"/>
        <span class="elright"><label>yLocation:</label><input name="ylocation" type="text"/></span></span>

        <span class="row"><input type="submit" value="Update" name="editadd" />
        <input type="submit" value="Delete" /></span>
        <div class="clear"></div>
    </form>

    <form id="AddForm" class="Processdata" action="@Url.Action("InsertPlace")">
        <span class="row"><label>Place Info:</label><input style="margin-left:50px;" type="submit" id="copyabove" value="Copy Above" onclick="return false;" /></span>
        <span class="row"><label>ID:</label><label name="id"></label><input type="hidden" name="id" />
        <span class="elright"><label>Type:</label><input type="text" name="type"/></span></span>
        <span class="row"><label>Fullname:</label><input class="elmax" name="fullname" type="text"/></span>
        <span class="row"><label>Address:</label><input class="elmax" name="addr" type="text"/></span>
        <span class="row"><label>Info:</label><input class="elmax" name="info" type="text"/></span>
        <span class="row"><label>Picture:</label><input class="elmax" name="picture" type="text"/></span>
        <span class="row"><label>Phone:</label><input type="text"  name="phone"/>
        <span class="elright"><label>Website:</label><input type="text"  name="website"/></span></span>
        <span class="row"><label>xLocation:</label><input name="xlocation" type="text"/>
        <span class="elright"><label>yLocation:</label><input name="ylocation" type="text"/></span></span>

        <span class="row"><input type="submit" value="Add" /></span>
        <div class="clear"></div>
    </form>
</div>